package stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class StringApiDemo2 {
    public static void main(String[] args) {
        Random random = new Random();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<10;i++)
        {
            list.add(random.nextInt(100));
        }
        System.out.println(list);

        int min=list.stream().min((e1,e2)->e1-e2).get();
        int max=list.stream().max((e1,e2)->e1-e2).get();
        System.out.println(min);
        System.out.println(max);

        int sum=list.stream().reduce((e1,e2)->e1+e2).get();
        System.out.println(sum);

    }
}
